[mypyc] Add 'bit' primitive type and streamline branching#9606
Merged
Conversation
It's only available as an error kind for primitives, and gets translated away during IR building.
Collaborator
Author
|
I'm going to merge this as soon as I have a green build, since this will get stale very quickly. A review would still be appreciated, and I will respond to review feedback in a separate PR if this PR has already been merged. |
TH3CHARLie
reviewed
Oct 17, 2020
TH3CHARLie
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Looking forward to seeing its boost on performance
Collaborator
Author
This probably has no direct impact of performance, but this will be useful when working on non-C backends. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
bitprimitive type that only has two valid values: 0 and 1. The existingboolean primitive type is different as it also supports a third value (for error).
This makes boolean a poor fit for low-level IR operations which never raise an
exception.
Use
bitas the result type of comparison operations and various primitives.Also simplify the branch operation to not have a special mode for branching on
negative values, since it's needlessly ad hoc. Primitives still support this mode,
but it gets converted away during IR building.
Work on mypyc/mypyc#748.